home *** CD-ROM | disk | FTP | other *** search
/ Quick PC 62 / Quick PC 62.iso / I386 / IIS5_01.CAB / IIS_asps6e5v.asp < prev    next >
Encoding:
Text File  |  1999-07-29  |  4.1 KB  |  66 lines

  1. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
  2. <HTML>
  3. <HEAD>
  4. <META HTTP-EQUIV="Content-Type" Content="text/html; charset=Windows-1252">
  5. <TITLE>Variables</TITLE>
  6. <SCRIPT LANGUAGE="JavaScript">
  7. <!--
  8.     TempString = navigator.appVersion
  9.     if (navigator.appName == "Microsoft Internet Explorer"){    
  10. // Check to see if browser is Microsoft
  11.         if (TempString.indexOf ("4.") >= 0){
  12. // Check to see if it is IE 4
  13.             document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
  14.         }
  15.         else {
  16.             document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
  17.         }
  18.     }
  19.     else if (navigator.appName == "Netscape") {                        
  20. // Check to see if browser is Netscape
  21.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/coua.css">');
  22.     }
  23.     else
  24.         document.writeln('<link rel="stylesheet" type="text/css" href="/iishelp/common/cocss.css">');
  25. //-->
  26. </script>
  27. <SCRIPT LANGUAGE="VBScript">
  28. <!--
  29. Sub Window_OnLoad()
  30.    Dim frmContents
  31.    On Error Resume Next
  32.    If Not Parent Is Nothing Then
  33.       Set frmContents = Parent.Contents
  34.       If Not frmContents Is Nothing Then
  35.             frmContents.Window.TOCSynch_Click
  36.       End If
  37.    End If
  38. End Sub
  39. //--></SCRIPT><META NAME="DESCRIPTION" CONTENT="Internet Information Services reference information">
  40. <META HTTP-EQUIV="PICS-Label" CONTENT='(PICS-1.1 "<http://www.rsac.org/ratingsv01.html>" l comment "RSACi North America Server" by "inet@microsoft.com <mailto:inet@microsoft.com>" r (n 0 s 0 v 0 l 0))'>
  41. <META NAME="MS.LOCALE" CONTENT="EN-US">
  42. <META NAME="MS-IT-LOC" Content="Internet Information Services"> 
  43. </HEAD>
  44.  
  45. <BODY BGCOLOR="#FFFFFF" TEXT="#000000">
  46.  
  47. <H2><A NAME="_variables"></A><SUP> <% If Request("DontFrame")<>1 Then Response.Redirect "/iissamples/sdk/asp/docs/SampFram.asp?ovfile=/iishelp/iis/htm/asp/asps6e5v.asp&srcfile=Simple/Variables" %></SUP>Variables</H2>
  48.  
  49. <H6>Overview</H6>
  50.  
  51. <P>Every application ever written, regardless of the programming language, has used variables of some sort, and ASP scripts are no exception. Both VBScript and JScript allow you to create and manage variables simply and easily. </P>
  52.  
  53. <P>Each language deals with variable declaration differently. Both JScript and VBScript are quite flexible about variables and their declaration. In VBScript, any variable is automatically considered to be of the <B>Variant</B> type when it is initially declared with the <B>Dim</B> statement. Each variable eventually is assigned a subtype, such as <B>Numeric</B> and <B>Array</B>. JScript is similar; the variable is initially declared with the <B>var</B> statement. Both languages, in general, try to perform much of the data type management, including type conversion, automatically. In fact, you don't even have to use the <B>Dim</B> or <B>var</B> statements at all to use a new variable; they are optional in their respective languages.</P>
  54.  
  55. <H6>Code Tour</H6>
  56.  
  57. <P>This sample declares several different kinds of variables, performs simple operations on them, and then displays them to the client browser using the special <% = ...%> script delimiters. An integer is assigned to the variable <I>intVariable</I>, added to itself, and the sum sent to the client browser. <I>StrVariable</I> is set to equal to the first name, is added to Smith, and sent to the client browser. Booleans and dates are likewise declared or created, initialized, manipulated, and displayed. </P>
  58.  
  59. <H6>Remarks</H6>
  60.  
  61. <P>Of particular interest is the final step in the date variable demonstration. In VBScript, the variable is first assigned a literal date string, and displayed. It is then reset, and assigned the value that is returned by the VBScript <B>Now</B> function, which returns the current system time. The JScript example uses the JScript <B>Date</B> function to set both the initial literal by passing parameters to the function, and then to set the variable equal to the current system time by passing no parameters to the function. </P>
  62. <hr class="iis" size="1">
  63. <p align="center"><em><a href="../../../common/colegal.htm">© 1997-1999 Microsoft Corporation. All rights reserved.</a></em></p>
  64. </BODY>
  65. </HTML>
  66.